package ${package.ServiceImpl};

import ${package.Entity}.${entity};
import ${package.Mapper}.${table.mapperName};
import ${package.Service}.${table.serviceName};
import ${superServiceImplClassPackage};
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.sinothk.server.support.entity.PageData;
import com.sinothk.server.support.entity.PageVo;
import com.sinothk.gpserver.util.PageDataUtil;
/**
 * <p>
 * ${table.comment!} 服务实现类
 * </p>
 *
 * @author ${author}
 * @since ${date}
 */
@Service
<#if kotlin>
    open class ${table.serviceImplName} : ${superServiceImplClass}<${table.mapperName}, ${entity}>(), ${table.serviceName} {

    }
<#else>
public class ${table.serviceImplName} extends ${superServiceImplClass}<${table.mapperName}, ${entity}> implements ${table.serviceName} {
<#--    @Override-->
<#--    public JsonBean findListByPage(Long projectId, Integer page, Integer pageCount){-->
<#--    IPage<${entity}> wherePage = new Page<>(page, pageCount);-->
<#--    ${entity} where = new ${entity}();-->

<#--    IPage<${entity}> iPage = baseMapper.selectPage(wherePage, Wrappers.query(where));-->

<#--    return JsonBean.returnResponse(ReturnPageData.fillingData(iPage.getTotal(), iPage.getRecords()));-->
<#--    }-->

<#--    @Resource-->
<#--    private ${entity}Mapper ${table.entityPath}Mapper;-->

    @Resource
    private ${table.mapperName} ${(table.mapperName)?uncap_first};

    /**
     * 查询分页数据
     *
     * @param pageVo 分页参数
     * @return PageData
     */
    @Override
    public PageData<${entity}> page(PageVo<${entity}> pageVo) {
        Page<${entity}> page = new Page<>(pageVo.getPageNum(), pageVo.getPageSize());
        IPage<${entity}> iPage = ${(table.mapperName)?uncap_first}.selectPage(page, null);
        return new PageDataUtil<${entity}>().create(iPage);
    }

<#--    @Override-->
<#--    public JsonBean add(${entity} ${entity?uncap_first}){-->
<#--    baseMapper.insert(${entity?uncap_first});-->
<#--    return JsonBean.returnResponse();-->
<#--    }-->

<#--    @Override-->
<#--    public JsonBean delete(Long id){-->
<#--    baseMapper.deleteById(id);-->
<#--    return JsonBean.returnResponse();-->
<#--    }-->

<#--    @Override-->
<#--    public JsonBean updateData(${entity} ${entity?uncap_first}){-->
<#--    baseMapper.updateById(${entity?uncap_first});-->
<#--    return JsonBean.returnResponse();-->
<#--    }-->
}
</#if>